package com.tiancheng.onecode.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tiancheng.onecode.entity.MerchantPayCert;
import com.tiancheng.onecode.entity.MerchantPayConfig;
import com.tiancheng.onecode.mapper.MerchantPayCertMapper;
import com.tiancheng.onecode.mapper.MerchantPayConfigMapper;
import com.tiancheng.onecode.service.IMerchantPayCertService;
import com.tiancheng.onecode.service.IMerchantPayConfigService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @Author: kellen
 * @Description:商户支付配置管理 service impl
 * @Date: create in 2024/12/9 18:22
 */
@Service
public class MerchantPayCertServiceImpl extends ServiceImpl<MerchantPayCertMapper, MerchantPayCert> implements IMerchantPayCertService {

    @Override
    public List<MerchantPayCert> queryByFileIds(List<String> fileIds) {
        if(CollectionUtils.isEmpty(fileIds)){
            return Collections.emptyList();
        }
        return this.list(new LambdaQueryWrapper<MerchantPayCert>().in(MerchantPayCert::getFileId,fileIds));
    }

    @Override
    public void deleteByFileId(String fileId) {
        this.remove(new LambdaQueryWrapper<MerchantPayCert>().eq(MerchantPayCert::getFileId,fileId));
    }
}
